/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mscs.server.promotion.logic;

import java.text.SimpleDateFormat;
import java.util.Vector;
import mscs.data.IToStringArrayCallBack;
import mscs.data.ITotalGiftProxy;
import mscs.data.pojo.TotalGift;

/**
 *
 * @author Administrator
 */
public class TotalGiftUtil extends GiftDiscountUtil {

    public TotalGiftUtil() {
        super(new ITotalGiftProxy());
    }
    @Override
    public Vector toDataVector() {
        return toDataVector(new TotalGiftCallback());
    }
}

class TotalGiftCallback implements IToStringArrayCallBack {

    public Vector<String> toStringArray(Object obj) {
        if(obj != null) {
            TotalGift totalGift = (TotalGift)obj;
            Vector<String> stringArray = new Vector<String>();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            stringArray.add(String.valueOf(totalGift.getPriceLimit()));
            stringArray.add(String.valueOf(totalGift.getGiftID()));
            stringArray.add(String.valueOf(totalGift.getGiftSum()));
            stringArray.add(sdf.format(totalGift.getStartDate()));
            stringArray.add(sdf.format(totalGift.getEndDate()));
            return stringArray;
        }
        return null;
    }
    
}
